package com.hqd.sellrelation.server.controller.communal;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hqd.common.model.PageParams;
import com.hqd.common.model.ResultBody;
import com.hqd.sellrelation.server.entity.CommunalData;
import com.hqd.sellrelation.server.service.CommunalDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/communal")
@Api(value = "CommunalDataController", tags = "[公海数据]->公海数据相关操作")
public class CommunalDataController {
    @Autowired
    private CommunalDataService communalDataService;

    /**
     * 分页获取公海数据列表
     *
     * @return
     */
    @ApiOperation(value = "分页获取公海数据列表", notes = "根据条件分页获取公海数据列表")
    @GetMapping("/getCommunalDataListPage")
    public ResultBody<IPage<CommunalData>> getCommunalDataListPage(@RequestParam(required = false) Map map) {
        log.info("CommunalDataController.getCommunalDataListPage -> {}", map);
        return ResultBody.ok().data(communalDataService.findListPage(new PageParams(map)));
    }
}
